<template>
    <view class="agreement">
		<h5_header>{{title}}</h5_header>
        <view class="content" v-html="text"></view>
    </view>
</template>

<script>
import { getAgreement } from '@/api/agreement/index.js'
import h5_header from '@/components/h5_header.vue'
export default {
	components: {
		h5_header,
	},
    data() {
        return {
			title: '',
            text: '',
        }
    },
    onLoad(option) {
        let id;
        if (option.type == 1) {
            this.title = '注册协议'
            id = 1494
        } else if (option.type == 2) {
            this.title = '隐私政策'
            id = 1633
        } else if (option.type == 3) {
            this.title = '入驻协议'
            id = 1498
        } else if (option.type == 4) {
            this.title = '服务规则'
            id = 1496
        } else if (option.type == 5) {
            this.title = '认证规则'
            id = 1615
        }
        this.getData(id)
    },
    methods: {
        async getData(id) {
            let res = await getAgreement({newsId: id})
            if (res.code == 0) {
                this.text = res.data.content
            } else {
				uni.showToast({
					title: res.msg,
					icon: 'none'
				})
            }
        }
    }
}
</script>

<style lang="scss" scoped>
.agreement {
    .content {
        padding: 20upx 50upx;
    }
}
</style>